package me.zhengjie.modules.quartz.repository

import me.zhengjie.modules.quartz.domain.QuartzJob
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.JpaSpecificationExecutor

import org.springframework.data.jpa.repository.Query

/**
 * @author Kuki Wu
 * @date 2019-01-07
 */
interface QuartzJobRepository : JpaRepository<QuartzJob?, Long?>, JpaSpecificationExecutor<QuartzJob?> {
    /**
     * 查询启用的任务
     * @return List
     */
    fun findByIsPauseIsFalse(): List<QuartzJob?>?

    /**
     * 根据BeanName和Param查询（设备数据采集任务用）
     */
    @Query(value = "select * from sys_quartz_job where bean_name= ?1 and params = ?2", nativeQuery = true)
    fun findByBeanNameAndParam(beanName: String?, params: String?): QuartzJob?
}